#include <cstdio>
#include <cstdlib>

struct LNode
{
	int data;
	LNode *next;
};

bool delete_(LNode*&head,int val)
{
	LNode *temp = head;
	if (temp->data == val)
	{
		head = head->next;
		free(temp);
		return 1;
	}
	else 
	{
		while (temp->next != NULL)
		{
			if (temp->next->data == val)
			{
				temp->next = temp->next->next;
				free(temp);
				return 1;
			}
			else 
			{
				temp = temp->next;
			}
		}

	}
	if (temp != NULL)
	{
		free(temp);
	}
	return 0;
}
void test()
{
	LNode *head;
	head->data = 10;
	LNode *second;
	second->data = 20;
	second->next = NULL;
	head->next = second;

	printf("%d\n",delete_(head,20));
	
}

int main()
{
	test();
	return 0;
}